package com.cmbyc.JDBC.source

import org.apache.flink.streaming.api.functions.source.{RichParallelSourceFunction, SourceFunction}

import java.sql.{Connection, PreparedStatement}

/**
 *
 * @program: com.cmbyc.JDBC
 * @author: YCLW058
 * @create: 2021-05-19 13:46
 * @decsription:
 *
 * */

class MySQLSource extends RichParallelSourceFunction[Student]{
  //定义 连接 编译语句
  var conn:Connection=_
  var ps:PreparedStatement=_

  override def run(ctx: SourceFunction.SourceContext[Student]): Unit = ???

  override def cancel(): Unit = ???

  override def close(): Unit = {
    if (conn!=null) conn.close()
    if (ps!=null) ps.close()
  }
}
